Imports Clo = Enhancements.Core.Logging
Imports Ref = System.Reflection
Imports Sys = System

Namespace Enhancements.Basic
    ''' <summary>The exception that is thrown when a value is in a range.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class IsInRangeException
        Inherits AssertException

        Private Sub New(ByVal _objectName As System.String, ByVal _object As Sys.Object, ByVal _objectMinimum As Sys.Object, ByVal _objectMaximum As Sys.Object)
            MyBase.New(_objectName)
            [Object] = _object
            ObjectMinimum = _objectMinimum
            ObjectMaximum = _objectMaximum
        End Sub

        Private __Object As Sys.Object = 0
        ''' <summary>Gets the value of the object that caused this exception.</summary>
        Public Property [Object]() As Sys.Object
            Get
                Return __Object
            End Get
            Private Set(ByVal _value As Sys.Object)
                __Object = _value
            End Set
        End Property

        Private __ObjectMinimum As Sys.Object = 0
        ''' <summary>Gets the minimum value allowed for the object.</summary>
        Public Property ObjectMinimum() As Sys.Object
            Get
                Return __ObjectMinimum
            End Get
            Private Set(ByVal _value As Sys.Object)
                __ObjectMinimum = _value
            End Set
        End Property

        Private __ObjectMaximum As Sys.Object = 0
        ''' <summary>Gets the maximum value allowed for the object.</summary>
        Public Property ObjectMaximum() As Sys.Object
            Get
                Return __ObjectMaximum
            End Get
            Private Set(ByVal _value As Sys.Object)
                __ObjectMaximum = _value
            End Set
        End Property

        ''' <summary>Throws an exception.</summary>
        ''' <param name="_objectName">Name of the object that is causing the exception.</param>
        ''' <param name="_object">Object that is causing the exception.</param>
        ''' <param name="_objectMinimum">Minimum value that is causing the exception.</param>
        ''' <param name="_objectMaximum">Maximum value that is causing the exception.</param>
        ''' <exception cref="IsInRangeException"> </exception>
        Friend Shared Sub ___Throw(ByVal _objectName As System.String, ByVal _object As Sys.Object, ByVal _objectMinimum As Sys.Object, ByVal _objectMaximum As Sys.Object)
            Dim _exception As IsInRangeException = New IsInRangeException(_objectName, _object, _objectMinimum, _objectMaximum)

            Throw _exception
        End Sub

    End Class
End Namespace
